package com.dy.config;


import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @ClassName:
 * @Author: 仄言in
 * @Desctiption: (描述)
 * @Date: 2021/4/8 13:34
 * @Version 1.0 (版本)
 */
@Configuration
public class RestTemplateConfig {
    @Bean
    @LoadBalanced   //Ribbon
    public RestTemplate getRestTemplate(){
        return new RestTemplate();
    }
//    //更改负载均衡策略，还是使用他们的,
//    //随机访问
//    @Bean
//    public IRule getIRule(){
//        return new RandomRule();
//    }
}
